package 反射注解.test01;

public class Test01 {
    public static void main(String[] args) {
        Class c = AnnotationTest01.class;
        //判断是否有@MyAnnotation
        boolean b = c.isAnnotationPresent(MyAnnotation.class);
        System.out.println(b);
        if (b){
            //获取注解对象
            MyAnnotation myAnnotation = (MyAnnotation)c.getAnnotation(MyAnnotation.class);
            System.out.println(myAnnotation);
            //获取注解属性
            System.out.println(myAnnotation.value());

        }
    }
}
